//
// Created by 123 on 2024/12/26.
//
#include "string.h"
#include "stdio.h"

typedef struct {
    char name[50];
    int age;
    float score;
} Student;

int main(void){
    Student stuArr[3] = {
            {"tom",18,60},
            {"jerry",28,70},
            {"hary",38,80}
    };
    //声明结构体指针，并指向数组第一个元素
    Student* ptr = stuArr;
    //使用指针遍历结构体数组
    for (int i = 0; i < 3; ++i) {
        printf("student:%d\n",i+1);
        printf("name:%s\n",(ptr+i)->name);
        printf("age:%d\n",(ptr+i)->age);
        printf("score:%.2f\n",(ptr+i)->score);
    }

    return 0;
}